$basemap_toggle_offset: 5px !default;
$basemap_toggle_size: $button_width * 2  !default;

@mixin basemapToggle() {
  .esri-basemap-toggle {
    cursor: pointer;
    position: relative;
    overflow: visible;
    width: $basemap_toggle_size + $basemap_toggle_offset;
    height: $basemap_toggle_size + $basemap_toggle_offset;
    background-color: transparent;
    @include boxShadow("none");
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: center;
    &:hover {
      background-color: transparent;
    }
  }

  .esri-basemap-toggle__container,
  .esri-basemap-toggle__image {
    width: $basemap_toggle_size;
    height: $basemap_toggle_size;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
  }

  .esri-basemap-toggle__container {
    z-index: 2;
    @include defaultBoxShadow();
  }

  .esri-basemap-toggle__image {
    background-color: $background_color;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-image: url(../base/images/basemap-toggle-64.svg);
  }

  .esri-basemap-toggle__image--secondary {
    margin-top: $basemap_toggle_offset;
    margin-left: $basemap_toggle_offset;
    z-index: 1;
    @include defaultBoxShadow();
    animation: esri-basemap-slide 2000ms ease-in-out;
  }

  .esri-basemap-toggle__image-overlay {
    position: absolute;
    z-index: 3;
    width: 100%;
    height: 100%;
    transition: background-color 125ms ease-in-out;
    background-color: rgba(255, 255, 255, 0);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    .esri-basemap-toggle:hover {
      background-color: rgba($button_text_hover_color, 0.4);
    }
  }

  .esri-basemap-toggle__title {
    flex: 1 0 100%;
    height: auto;
    font-size: 9px;
    font-weight: 500;
    line-height: $line_height;
    padding: .5em;
    background-color: rgba(255, 255, 255, 0.7);
    text-align: center;
  }

  .esri-basemap-toggle.esri-disabled {
    .esri-basemap-toggle__image-overlay,
    .esri-basemap-toggle__image--secondary {
      background-color: $background_color;
      &:before {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 5;
        width: 100%;
        height: 100%;
        content: "";
        background-color: $background_color;
        opacity: 0.25;
      }
    }
    .esri-basemap-toggle__image-overlay {
      background-image: url(../base/images/basemap-toggle-64.svg);
    }
    .esri-basemap-toggle__image--secondary:before {
      opacity: 1;
    }
    .esri-basemap-toggle__title {
      display: none;
    }
  }

  .esri-widget.esri-basemap-toggle,
  .esri-ui-corner {
    .esri-widget.esri-basemap-toggle {
      background-color: transparent;
      @include boxShadow("none");
    }
  }
}

////////////////////////////////////////
//  ANIMATIONS
@keyframes esri-basemap-slide {
  0% {
    margin-top: 0;
    margin-left: 0;
    opacity: 0;
  }
  75% {
    margin-top: 0;
    margin-left: 0;
    opacity: 0;
  }
  100% {
    margin-top: $basemap_toggle_offset;
    margin-left: $basemap_toggle_offset;
    opacity: 1;
  }
}

@if $include_BasemapToggle == true {
  @include basemapToggle();
}
